--
-- This simple applet just shows the fltk clock widget
--
-- Written by Tomas Lindquist Olsen, Sep 26 2010
--

-- we want to put it in the top right corner on the first monitor
local monitor = Monitor:find(0,0)
local top = 0
local right = monitor.work:w()-1

-- now we create a window for the applet
-- 100x100 px
local wnd = Window:new(100,100)
wnd:position(right-100, top)
wnd:border(false)
wnd:begin_group()

-- and create the clock
local clock = Clock:new(0,0,100,100);

wnd:end_group()
wnd:show()

-- set the skip-taskbar wm hint
wnd:wm_hint(SKIP_TASKBAR_HINT, HINT_ADD)

-- by default a Window closes when it gets an Escape key event
-- we override this to make it do so on Ctrl+'q' instead (after the widget has received focus)
wnd:shortcut(CTRL + string.byte("q"))
wnd:callback(function()
    wnd:destroy()
end)
